<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="/wk1un2/Backstage/lib/layui/css/layui.css" />
</head>
<body>
          <!-- 编辑 -->
	<form class="layui-form" action="">
		<div class="layui-form-item" hidden="hidden">
			<label class="layui-form-label">设计师ID:</label>
			<div class="layui-input-inline" style="width: 350px;">
				<input type="text" id="id" name="id" class="layui-input"
					readonly="true">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">设计师姓名:</label>
			<div class="layui-input-inline" style="width: 350px;">
				<input type="text" id="name" name="name" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">设计师头像:</label>
			<div class="layui-input-inline" style="width: 350px;">
				<input type="text" id="imgUrl" name="imgUrl" required=""
					autocomplete="off" class="layui-input" >
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">设计师职位:</label>
			<div class="layui-input-inline" style="width: 350px;">
				<input type="text" id="position" name="position" required=""
					autocomplete="off" class="layui-input" >
			</div>
		</div>
		<div class="layui-btn-container" style="text-align: center;">
			<button class="layui-btn" lay-filter="userEditBtu" lay-submit="">
				修改</button>
		</div>
	</form>
	<script type="text/javascript"
		src="/wk1un2/Backstage/lib/layui/layui.js"></script>
	<script>
		//加载了layui的form模块
		layui.use('form', function() {
			var form = layui.form;
			var $ = layui.jquery; //引入jquery
			//监听提交
			form.on('submit(userEditBtu)', function(data) {
				var d = data.field; //表单中的数据，定义一个对象来接收
				d.method = "update"; // 执行的方法
				//通过ajax向数据库提交数据了
				console.log(d); //提交之前的一个数据验证、通过打印的方式先手动的去判断一下这个数据
				var url = '/wk1un2/HouDesignServlet';//请求的接口
				//确保数据没有问题就进行ajax提交了
				$.post(url, d, function(data) {
					if (data.count > 0) {
						console.log('修改成功');
						var index = parent.layer.getFrameIndex(window.name); //获取当前窗口的name
						parent.layer.close(index); //关闭窗口
					}
				}, "json");
				return false;
			});
		});
	</script>
</body>
</html>